|
Re: Regarding Concatenation of Strings Let me guess what was deleted. each concatenated string takes up space in the "string table" within the current DXL context. Some clever hash-function can find a string in that table, and insert it if it does not. DXL interpreter is not clever enough to realize that a string not saved in a variable or some allocated container cannot be "used" again when the current function ends; thus the string table persists. I believe the following ...
.. will result in these strings end up in the string table (in this order):
Taking up 13 bytes not 4. I think this..
.. ends up with 500,000 bytes wasted in the string table; just to create a 1000 byte string. You must therefore avoid concatenation inside loops. Buffers are good for that:
I think puts 1001 bytes in the table. It runs faster as well, but that is insigificant. The function "tempStringOf" does NOT put the string in the string table; instead returns the address in the buffer where the string can be found. if you subsequently change the Buffer contents then you have also changed the variable contents. Thus, tempStringOf() can be used only if you immediately ignore the string or displose of the string (print, write, set attr-value, set on dialog). -Louie |
Re: Regarding Concatenation of Strings llandale - Thu May 02 11:58:12 EDT 2013 Let me guess what was deleted. each concatenated string takes up space in the "string table" within the current DXL context. Some clever hash-function can find a string in that table, and insert it if it does not. DXL interpreter is not clever enough to realize that a string not saved in a variable or some allocated container cannot be "used" again when the current function ends; thus the string table persists. I believe the following ...
.. will result in these strings end up in the string table (in this order):
Taking up 13 bytes not 4. I think this..
.. ends up with 500,000 bytes wasted in the string table; just to create a 1000 byte string. You must therefore avoid concatenation inside loops. Buffers are good for that:
I think puts 1001 bytes in the table. It runs faster as well, but that is insigificant. The function "tempStringOf" does NOT put the string in the string table; instead returns the address in the buffer where the string can be found. if you subsequently change the Buffer contents then you have also changed the variable contents. Thus, tempStringOf() can be used only if you immediately ignore the string or displose of the string (print, write, set attr-value, set on dialog). -Louie Thankyou very much. It works now. But I need to look for column title for three attributes , fetch that column title to Object Text. How to fetch the column title? Do you have any code snippet for that? |
Re: Regarding Concatenation of Strings DXLUserbsr - Fri May 03 15:16:07 EDT 2013 Thankyou very much. It works now. But I need to look for column title for three attributes , fetch that column title to Object Text. How to fetch the column title? Do you have any code snippet for that? Not sure what you are asking. Does this help?
-Louie |